package com.winmastergames.remotemonitor;

import java.util.Timer;
import java.util.TimerTask;
import android.util.Log;
import android.widget.TextView;

public class RefreshTimer2 extends TimerTask
{
	WeatherAdapterView updateStat;
	Timer timer;
	CustomAdapterActivity ref;
	TextView txt_numitems;
	public RefreshTimer2(int updateRate, WeatherAdapterView update, CustomAdapterActivity mainRef)
	{
		ref = mainRef;
		updateStat = update;
		timer = new Timer();
		timer.scheduleAtFixedRate(this, 1 * (30 * 1000), 1 * (30 * 1000));
		txt_numitems = (TextView) ref.findViewById(R.id.numitems);
	}
	public void run()
	{
		ref.numUpdates += 1;
		Log.d("VAL", String.valueOf(ref.numUpdates));
		try
		{
			txt_numitems.setText(String.valueOf(ref.numUpdates));
		} catch (Exception e)
		{
			Log.e("ERR", e.getMessage());
		}
		updateStat.updateResources();
	}
}
